﻿using System;
using System.Collections.Generic;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            //            <?xml version="1.0" encoding="utf-8"?>
            //< Response>
            //    <Head>
            //            <Result>0</Result>
            //            <ResultDesc>成功</ResultDesc>
            //    </Head>
            //    <Body>
            //        <CorpName>福建信息产业厅</CorpName>
            //        <ProvinceCode>FJ</ProvinceCode>
            //        <CorpZone>591</CorpZone>
            //        <CorpManager>法人代表</CorpManager>
            //        <Telephone>18900000001</Telephone>
            //        <Email>esy@189.cn</Email>
            //        <FAX>059100000001</FAX>
            //        <CorpType>0</CorpType>
            //        <County>00</County>
            //        <Address>联系地址</Address>
            //        <Contact>联系人</Contact>
            //        <Description>描述</Description>
            //        <CustType>1</CustType>
            //        <RegChannel>1</RegChannel>
            //    </Body>
            //</ Response>

            var visitor = new XMLNodeVisitor();
            var response = new MyNode("Response")
                .SetChilds(
                    new MyNode("Head").SetChilds(
                         Tuple.Create("ID", "123"),
                         Tuple.Create("Name", "jz")
                    )
                    ,
                    new MyNode("Body").SetChilds(
                        Tuple.Create("CorpName", "福建信息产业厅")
                    )
                );

            var str = visitor.Visit(response);
            Console.WriteLine(str);
        }
    }
}
